home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: April 29, 1997
- // Author: RS
- //
- // Description:
- // The circularFilletPreset() procedure executes one circular fillet (
- // rollingBall fillet really !) operation given two NURBS surfaces,
- // based on the option vars.
- //
- // Input Arguments:
- // None.
- //
- // Return Value:
- // None.
- //
-
-
- proc string pieceTogetherCmd(
- int $doHistory,
- int $asPolygons,
- float $pr,
- int $revPrimary,
- int $revSecondary,
- float $c0tol,
- float $g1tol,
- int $genCos )
- //
- // Description :
- // Put together an extrude Cmd.
- //
- {
- string $cmd = "circularFillet" ;
-
- // history.
- //
- $cmd = $cmd + " -ch " ;
- if( $doHistory == 1 ) $cmd = $cmd + "true" ;
- else $cmd = $cmd + "false" ;
-
- //$cmd = $cmd + " -po " ;
- //if( $asPolygons == 1 ) $cmd = $cmd + "true" ;
- //else $cmd = $cmd + "false" ;
-
- // primary radius.
- //
- $cmd = $cmd + " -pr " ;
-
- float $prad = $pr ;
- if( $revPrimary == 1 ) $prad = $prad * -1 ;
- $cmd = $cmd + $prad ;
-
- // secondary radius.
- //
- $cmd = $cmd + " -sr " ;
- float $srad = $pr ;
- if( $revSecondary == 1 ) $srad = $srad * -1 ;
- $cmd = $cmd + $srad ;
-
- // position continuity tol.
- //
- $cmd = $cmd + " -pt " ;
- $cmd = $cmd + $c0tol ;
-
- // g1 continuity tolerance.
- //
- $cmd = $cmd + " -tt " ;
- $cmd = $cmd + $g1tol ;
-
- // generate cos.
- //
- $cmd = $cmd + " -cos " ;
- if( $genCos == 1 ) {
- $cmd = $cmd + "true" ;
- } else {
- $cmd = $cmd + "false" ;
- }
-
-
- return $cmd ;
- }
-
- global proc circularFilletPreset(
- int $doHistory,
- int $asPolygons,
- float $pr,
- int $revPrimary,
- int $revSecondary,
- float $c0tol,
- float $g1tol,
- int $genCos )
- //
- // Description :
- // Proc to do one circular fillet operation.
- //
- {
- //---------------------------------------------
- // Get the list of nurbs surfaces in select list.
- //---------------------------------------------
- //
- global int $gSelectNurbsSurfacesBit;
- global int $gSelectIsoparmsBit;
- global int $gSelectSurfaceParmPointsBit;
- global int $gSelectCurvesOnSurfacesBit;
- string $inpList[] = `filterExpand -ex true -sm $gSelectNurbsSurfacesBit `;
-
- string $filletPair[2];
-
- //--------------------------------------------
- // Valid # of items.
- //--------------------------------------------
- //
- int $count = size($inpList) ;
- if( $count >= 2 ) {
- if( $count > 2 ) {
- warning ("Only two surfaces should be selected to do circular " +
- "fillet. The last 2 selected surfaces will be used.");
- }
- $filletPair[0] = $inpList[$count-2];
- $filletPair[1] = $inpList[$count-1];
- }
- else {
- $revPrimary = 0;
- $revSecondary = 0;
- if( $pr < 0 ) $pr = -1 * $pr;
-
- $inpList = `filterExpand -ex true -sm $gSelectIsoparmsBit -sm $gSelectSurfaceParmPointsBit`;
- $count = size($inpList) ;
-
- // These would be isoparms or surface points:
- if( $count >= 2 ) {
- if( $count > 2 ) {
- warning ("Only two surface isoparms or points should be " +
- "selected to do circular fillet. The last 2 " +
- "selected will be used.");
- }
- $filletPair[0] = $inpList[$count-2];
- $filletPair[1] = $inpList[$count-1];
- }
- }
-
- if( $count < 2 ) {
- error ("Select two NURBS surfaces, two isoparms or two surface " +
- "points to do circular fillet");
- }
-
- if( $count >= 2 ) {
- //---------------------------------------
- // put together an rolling ball fillet cmd.
- //---------------------------------------
- //
- string $cmd = pieceTogetherCmd( $doHistory, $asPolygons, $pr, $revPrimary,
- $revSecondary, $c0tol, $g1tol, $genCos);
-
- //----------------------------------------
- // place holders for 2 selection items.
- //----------------------------------------
- //
- int $nitems = 2 ;
- $cmd = appendToCmdPlaceHoldersForSelectionItems($cmd,$nitems) ;
-
- string $results[] = executeCmdOnItems($cmd,$filletPair);
-
- // select all results.
- //
- $count = size($results) ;
- $selectString = "select -r ";
- int $i ;
- for( $i = 0 ; $i < $count ; $i++ ) {
- $selectString += $results[$i] ;
- $selectString += " ";
- }
- $selectString += ";";
- select -cl ;
- eval($selectString) ;
- }
- }
-
-